var {arg1:name,arg2:age}={arg1:"itcast",arg2:11}
console.log(name,age);



//先查找同名属性然后在赋值

//不受顺序的限制



//嵌套
// var {name:name,son:{sonName}}={name:"顺治",son:{sonName:"康熙"}}
// console.log(name,sonName);


//解析不成功则undefined
var {name,age,sex}={name:"顺子",age:120};
console.log(name,age,sex);//顺子 120 undefined


//默认值
var {name,age,sex="男"}={name:"私自",age:22222};
var {name,age,sex:sex="男"}={name:"私自",age:22222};//完整写法

console.log(name,age,sex);

var {name,age,sex:sex="男"}={name:"私自",age:22222,sex:undefined}
console.log(name,age,sex);//undefined 走默认值


var {name,age,sex:sex="男"}={name:"私自",age:22222,sex:null}
console.log(name,age,sex);//undefined 走默认值




